package lion.framework.core.db.paging;

import lion.framework.core.db.anno.SQLPaging;

/**
 * mysql 数据库分页 行数从1开始记
 * 
 * <pre>
 * time   2013 2013-4-24 上午11:28:29 
 * mail   hl_0074@sina.com
 * </pre>
 * 
 * @author lion
 */
@SQLPaging("mysql")
public class MySQLPaging implements ISQLPaging {

	@Override
	public String paging(String sql, int start, int size) {

		start = start - 1;
		if (start <= 0) {
			start = 0;
		}
		if (size < 0) { return sql; }
		return sql + " limit " + start + "," + size;
	}
}
